Skip to main content

mergBgTask

Type

library

Description

mergBgTask is an iOS external that adds commands to start and stop background tasks on iOS. Background tasks allow your app to continue executing code while in the backgound. This external should be considered experimental as it invloves letting LiveCode go into a suspended state rather than quit which is currently unsupported by LiveCode. Your background tasks should not be blocking so that you can handle the mergBgTaskExpired message appropriately to start a new task if neccessary. Use mergNotify notifications from UIApplication such as UIApplicationDidEnterBackgroundNotification and UIApplicationWillEnterForegroundNotification to determine if your task is running in the background and therefore shouldn't do unnecessary things like update the UI (even though I have done that in the demo). mergBgTask requires UIApplicationExitsOnSuspend to be set to NO in the application plist.

Associated Syntax

Command

NameSummarySyntax
mergBgTaskStartStart a background taskmergBgTaskStart
mergBgTaskStopStop a background taskmergBgTaskStop <pBackgroundTaskIdentifier>

Message

NameSummarySyntax
mergBgTaskExpiredSent to the object that called mergBgTaskStart when the background task expires mergBgTaskExpired <pBackgroundTaskIdentifier>

Function

NameSummarySyntax
mergBgTaskTimeRemainingThis function returns the amount of time the application has to run in the background before it may be forcibly killed by the system mergBgTaskTimeRemaining()
mergBgTaskCurrentStateThis function returns the current state of the applicationmergBgTaskCurrentState()
Thank you for your feedback!

Was this page helpful?